class Map(object):
    def __init__(self,tmap=[[]]):
        self.tmap=tmap
    def fly(self,ppl,x,y):
        try:
            if self.tmap[x][y]==0:
                a,b=self.getPosition(ppl)
                self.tmap[x][y]=ppl
                self.tmap[a][b]=0
                return x,y
            else :
                return False
        except:
            print 'out of array'
            return False
    def getPosition(self,ppl):
        for i,obj in enumerate(self.tmap):
            for j,obj2 in enumerate(obj):
                if obj2 == ppl:
                    return i,j
    def complete(self):
        for i,obj in enumerate(self.tmap):
            for j,obj2 in enumerate(obj):
                if isinstance(ppl,Enemy):
                    if ppl.isOver() == True :
                        return True
                else :
                    return False
                    
